function [resp,rt,t] = block_emotion(w,rect,stimuli,noise)


%[width,height]=Screen('DisplaySize',w)
%T_em=zeros(1,n_trials);
%Resp_em=zeros(1,n_trials);
%T_conf=zeros(1,n_trials);
%Resp_conf=zeros(1,n_trials);
%DtStim=zeros(1,n_trials);
%[stimuli,stimType]=stimulus_list(n_trials,'emotion');
%goodAnswer=zeros(1,n_trials);
t=0.015;
%proportion de bruit dans l'affichage
duration=.5;

if nargin<4
	noise=.25;
end

Question = { 'Cette personne est-elle joyeuse ?' 'OUI   NON'};
	
cross(w,rect);
WaitSecs(0.1)
dtStim=disp_frame(w,stimuli,duration,noise);
%tStim=Screen('flip',w)
%[t_em,resp_em]=q_emotion(w)

%question de emotion
DrawText(w,Question,'cm');
t_question=Screen('Flip',w) ;%affiche l'image 1 seconde

%attente d'une réponse clavier
resp= NaN;
t_resp = NaN;

while isnan(resp)
    [t_resp,key]=KbWait;
    if key(KbName('s')) % s : joyeux
        resp=1;
    elseif key(KbName('h')) % h : neutre
        resp=0;
    elseif key(KbName('Escape')) % Escape
        resp=2;
        t_resp = NaN;
    end
end

if resp
    Response = [Question(1) {'OUI      '}];
elseif resp==0
    Response = [Question(1) {'      NON'}];
end    

DrawText(w,Response,'cm');
Screen('Flip',w);
Waitsecs(0.5)

rt=t_resp-t_question

t=[dtStim]
WaitSecs(.4);


%if Resp_em(i)==stimType(i)
%		goodAnswer(i)=1
%end
	
%percent_goodAnswer=length(find(goodAnswer))/n_trials
 %save is1.mat noise DtStim T_em Resp_em T_conf Resp_conf stimType goodAnswer percent_goodAnswer
 
%save(filename)
 
